package com.itjiange;

import java.util.Iterator;
import java.util.List;

/**
 * @author ItJianGe
 * @data 2024/8/26 10:40
 */
public class BMenusIterator implements MenuIterator {

    private MenuItem[] menuItems;
    private int i;

    public BMenusIterator(MenuItem[] menuItems) {
        this.i = 0;
        this.menuItems = menuItems;
    }

    @Override
    public boolean hasNext() {
        return menuItems != null && i < menuItems.length &&  menuItems[i] != null;
    }

    @Override
    public MenuItem next() {
        return menuItems[i++];
    }
}
